package com.b2c.oa;


import com.b2c.oa.controller.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .excludePathPatterns(Arrays.asList("/css/**", "/js/**", "/login", "/images/**", "/v3/js/**","/v3/images/**","/v3/css/**"));

        registry.addInterceptor(authInterceptor).excludePathPatterns(Arrays.asList("/css/**", "/js/**", "/login", "/images/**", "/v3/**","/mogujie/callback","/mogujie/notify"));
    }
}
